﻿using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using T.E.ERP.Write.API.Applicantions.Command.ProcurementsCommand;

namespace T.E.ERP.Write.API.Controllers
{
    /// <summary>
    /// 采购管理的控制器-写
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProcurementsController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        private readonly IMediator mediator;
        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="mediator"></param>
        public ProcurementsController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 开票订单的添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddInvoiceSettlementEntity(InvoiceSettlementEntityAddCommand command)
        {
            return await mediator.Send(command);
        }


        /// <summary>
        /// 开票订单的添加(包含物料信息)
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddInvoiceSettlementEntityALL(AddInvoiceSettlementEntityCommand command)
        {
            return await mediator.Send(command);
        }



        /// <summary>
        /// 开票订单的修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<APIResult<object>> UdpInvoiceSettlementEntity(InvoiceSettlementEntityUdpCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 更改开票通知单的状态
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<APIResult<int>> UdpShenpiStatus(UdpShenPiStatusCommand command)
        {
            return mediator.Send(command);
        }


        /// <summary>
        /// 更改开票通知单的所有信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<APIResult<int>> UdpInvoiceSettlementEntityALL(UdpInvoiceSettlementEntityCommand command)
        {
            return mediator.Send(command);
        }

        /// <summary>
        /// 审核采购订单
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<object>> UpdateAlpe(AppUpdateCommand command)
        {
            return mediator.Send(command);
        }


        /// <summary>
        /// 审核采购到货
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<object>> UpdateAliv(AddUpdateAlivCommd command)
        {
            return mediator.Send(command);
        }
        /// <summary>
        /// 审核采购退货单
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> Updproreturn(UpdReturnDtateCommand command)
        {
            return await mediator.Send(command);
        }
    }
}
